<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Client Account Detail Form</title>
<link rel="stylesheet" type="text/css" href="css/loginstyle.css"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/ddaccordion.js"></script>
<link rel="stylesheet" type="text/css" href="css/popup_css.css" />
<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader",
	contentclass: "submenu",
	revealtype: "click", 
	mouseoverdelay: 200,
	collapseprev: true, 
	defaultexpanded: [], 
	onemustopen: false, 
	animatedefault: false,
	persiststate: true,
	toggleclass: ["", ""], 
	togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], 
	animatespeed: "fast", 
	oninit:function(headers, expandedindices){ 
	},
	onopenclose:function(header, index, state, isuseractivated){ 
	}
});
	
	$(document).ready(function() {
		$('#close').click(function(){
		    parent.history.back();
		    return false;
		});
		
		$.ajax({
			url : './user/userDetail',
			dataType: "json",
			contentType: 'application/json',			  
			success : function(jsonData) {
			var select = document.getElementById("userId");
				var option = document.createElement("option");
				select.appendChild(option);
				for(var a in jsonData){				
						var option = document.createElement("option");
            	        option.value =jsonData[a]["userId"]; ;
            	        option.textContent = jsonData[a]["userId"];;
            	        select.appendChild(option);
				}	
			}
		});
		
		$('#userId').change(function(event) {  
		    var userId=$("select#userId").val();
		    $.ajax({
		    	type:"POST",
				url : './user/selectUser',
				dataType: "json",
				contentType: 'application/json',			  
				 data:userId, 
				success : function(jsonData) {
					for(var a in jsonData)
				{
					document.getElementById("password").value=jsonData[a]["password"];
					document.getElementById("transpwd").value=jsonData[a]["transpwd"];
					}
			
				}
			});
		       });
		
		$("#submit").click(function(event) { 
			var reqUrl="./user/updateUser";
			var jsondata = JSON.stringify({"userId":$("#userId").val(),"password":$("#password").val(),"transpwd":$("#transpwd").val()});
		$.ajax(
			  {
			  type: "POST",
			  url: reqUrl,
			  dataType: "json",
			  contentType: 'application/json', 
			  data:jsondata, 
			  success: function(jsonResponse) { 
				  alert(jsonResponse["msg"]);
				  document.getElementById("userId").value="";
				  document.getElementById("password").value="";
				  document.getElementById("transpwd").value="";
			  }
			});
		});
	});
	
	
function enter()
	{
	location.href = "clientpage.html";
	}
</script>


<style>
.reg_form{
width:680px;
height:230px;
background:#fff;
margin:20px 0 0 145px;
float:left;
padding:0px 0 0 0px;
border-radius:10px;
}


.signup-3{width:94%; float:left; margin:13px 22px 5px ;}

.signup-3left{width:150px; float:left; border-radius:5px; height:25px;}

.signup-3right{width:150px; float:left; border-radius:5px; height:25px; margin-left:174px;}

.signup-3-input{width:296px; float:left; border-radius:5px; height:25px;}


.signup-button{float:left; width:400px; margin-top:1%;}
.button{background: linear-gradient(#67AE55, #578843) repeat scroll 0 0 #69A74E; border-color: #3B6E22 #3B6E22 #2C5115; box-shadow: 0 1px 1px #A4E388 inset; padding:8px 0px; float:left; width:150px; border-radius:5px; text-align:center; color:#FFFFFF; font-size:18px; font-weight:bold;}

</style>
 
</head>
<body>

<div id="main_container">

	<div class="header_login">
    <div class="logo"><a href="#"><img src="img/ncmx-logo.png" alt="" title="" border="0" width="200" height="70"/></a></div>
    
    </div>
    
         <div class="reg_form">
         
         <h3>Manage Password </h3>
         <br/><br/>
         <div class="signup-3">
         <div class="signup-3left">
                   	<select  id="userId"  >
                   	
                   	</select>
                   </div></div>
         <form id="managePwd" method="post" action="./managePwd">  
             <div class="signup-3">
                <div class="signup-3left">
       				 <input name="password" type="text" value="" maxlength="170" id="password" placeholder="Password" 
       				 class="signup-3-input" data-type="text" style="border:1px #c2bdbd solid; padding:2px 5px;" />
                </div>
                
                <div class="signup-3right">
      				 <input name="transpwd" type="text" value="" maxlength="170" id="transpwd" placeholder="Transaction Password"
      				  class="signup-3-input" data-type="text" style="border:1px #c2bdbd solid; padding:2px 5px;" />
                </div>       <br/>
                   
                   <br/><br/>
					<div class="signup-button">
                   		<input class="button" type="button" name="submit" id="submit" value="Update"></input>
                   	</div>
                        
                        </div>
                        <a class="close" href="#" id="close" style=" right: 310px; top: 126px;"></a>   
                        </form>
         </div>  
    <div class="footer_login">
    	<div class="left_footer_login"> <a href="#"></a></div>
    	<div class="right_footer_login"><a href="#"></a></div>
    </div>

</div>		
</body>
</html> 